<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta content="email=no" name="format-detection">
<meta content="telephone=no" name="format-detection">
	<title>用户绑定</title>
	<link rel="stylesheet" type="text/css" href="../../css/binding.css">
	<script type='text/javascript' src="../asset/js/jquery_simple.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="../asset/js/baseinfo.js"></script>
	<link rel="stylesheet" type="text/css" href="../../font-awesome-4.5.0/css/font-awesome.min.css">
</head>
<body>
	<div class="return">
		<!-- <a href="#"><span class="fa fa-angle-left"></span></a> -->
	</div>
	<div class="wrap">
		<div class="header">
			<p class="en">BINDING</p>
			<p class="ch">用户绑定</p>
			<p class="msg">首次登陆需进行新用户绑定</p>
		</div>
		<div class="content">
			<form action="" >
			<div class="user_num">
				<div class="user_ch">用户编号</div>
				<input type="text" placeholder="请输入水费单据上的用户编号" id="userCode" />
			</div>
			<div class="tel">
				<div class="user_tel">手机号码</div>
				<input type="text" placeholder="请输入立户时登记的电话号码"  id="phoneNo"/>
			</div>
			<!-- <div class="cer">
				<div class="user_cer">身份证号</div>
				<input type="text" placeholder="请输入立户时登记的身份证号" id="identity" />
			</div> -->
			<div class="zhuyi">*用户编号为水费单据上的用户编号，电话为立户时所登记的号码！</div>
			<button type="button" value="提交" class="btn" onclick="bingDingUser();">提交</button>
			</form>
		</div>
	</div>
	<!-- <div class="nav">
		<ul>
			<li><img class="tubiao" src="../../images/icon_index.png"></li>
			<li><img class="tubiao" src="../../images/icon_mine_active.png"></li>
			<li><img class="tubiao" src="../../images/icon_affiche.png"></li>
			<li><img class="tubiao" src="../../images/icon_service.png"></li>
		</ul>
	</div> -->
</body>
<script type="text/javascript">
function bingDingUser(){
  var  userCode=$("#userCode").val();
  var  phoneNo=$("#phoneNo").val();
  var  identity=$("#identity").val();
if (null == userCode || userCode == "") {
		alert("用户编号不能为空！");
		return false;
	}
if (null == phoneNo || phoneNo == "") {
		alert("手机号码不能为空！");
		return false;
	}
		var reg = /^1[3|4|5|7|8][0-9]\d{4,8}$/;
		if (!reg.test(phoneNo)) {
			alert("手机号码格式不对！");
			return ;
		}
	/* if (null == identity || identity == "") {
		alert("身份证号码不能为空！");
		return false;
	} */
	
  var href =preUrl+"user/bindUserInfo";
	$.ajax({
		type : "POST",
		url : href,
		async : true,
		dataType : "json",
		data : {"userNo" : userCode,"phoneNo":phoneNo,"openId":getOpenId()},
		success : function(data) {
			if (data.rspCode=="0") {
				alert(data.rspMsg);
				return;
			}else if(data.rspCode=="0000"){
				alert("绑定成功！");
				window.location.href =preUrl+ "wechat/user/home.html?userId="+data.data.id+"&homeUserNo=" + data.data.userNo;
			}
}
});
}

</script>
</html>